package com.old.care.oldsportsystem.model.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResponseResult<T> {
    private Integer code;
    private String msg;
    private T data;

    //成功响应
    public static <T>ResponseResult<T> success(T data){
        return new ResponseResult<>(200,"操作成功",data);
    }

    // 失败响应
    public static <T>ResponseResult<T>error(String message){
        return new ResponseResult<>(500,message,null);
    }

    //自定义状态码响应
    public static<T>ResponseResult<T> result (Integer code,String message,T data){
        return new ResponseResult<>(code,message,data);
    }
}
